from main.commons.func_aux import find_in_seq

class Disk(object):

    def __init__(self):
        self.__programs = []

    def save(self, program):
        self.__programs.append(program)
        
    def get_program_by_name(self, program_name):
        """TODO catch exception and raise custom"""
        condition = lambda x : x.name == program_name
        return find_in_seq(self.__programs, condition) or self.program_non_exist()
